package com.wfit.controller.app;

import com.wfit.context.UserContext;
import com.wfit.dto.CartDto;
import com.wfit.dto.LoginFormDTO;
import com.wfit.dto.RegisterDto;
import com.wfit.po.Users;
import com.wfit.result.Result;
import com.wfit.service.CartService;
import com.wfit.service.UsersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/cart")
@RequiredArgsConstructor
public class CartController {
    @Autowired
    private CartService cartService;
    /**
     * 购物车新增
     * @return
     */
    @PostMapping("/add")
    public Result addCart(@RequestBody CartDto dto) {
        Result result = cartService.addCart(dto);

        return result;
    }
    /**
     * 购物车数据查询
     * @return
     */
    @GetMapping("/list")
    public Result cartlist() {
        Result result = cartService.getlist();

        return result;
    }
    /**
     * 购物车数据查询
     * @return
     */
    @GetMapping("/clear")
    public Result delectCart( String cartIds) {
        Result result = cartService.delectCart(cartIds);

        return result;
    }


}
